﻿<%@ Page 
    Title="GIARS - Access Records" 
    Language="vb" 
    AutoEventWireup="false" 
    MasterPageFile="~/Logged.Master" 
    CodeBehind="AccessRecords.aspx.vb" 
    Inherits="giarsweb.AccessRecords" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<title >Access Records</title>
</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="Menu_ContentPlaceHolder" runat="server">
    <ul id="menu" class="blue">
	    <li class="active"><a href="AccessRecords.aspx" >Access Records</a></li>
        <li ><a href="Log.aspx" >Log</a></li>
	    <li ><a href="Passes.aspx">Passes</a></li>
	    <li ><a href="Customers.aspx">Customers</a></li>
	    <li ><a href="Users.aspx">Users</a></li>
        <li ><a href="About.aspx">About</a></li>
    </ul>
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <h2>Access Records</h2>
<%--        <br />--%>
        <div>
            <p class="infoMsgText"><asp:Label ID="info_Label" runat="server" Text=""></asp:Label></p>
        </div>
        <div class="grouped">
            <fieldset class="groupbox">
                <legend >Pass Issue</legend>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <asp:Table ID="Table1" runat="server" Height="100%" Width="100%">
                        <asp:TableRow runat="server">
                            <asp:TableCell ID="TableCell1" runat="server" VerticalAlign="Top" Width="30%"></asp:TableCell>
                            <asp:TableCell ID="TableCell2" runat="server" VerticalAlign="Top" Width="5%"></asp:TableCell>
                            <asp:TableCell ID="TableCell3" runat="server" VerticalAlign="Top" Width="30%"></asp:TableCell>
                            <asp:TableCell ID="TableCell4" runat="server" VerticalAlign="Top" Width="5%"></asp:TableCell>
                            <asp:TableCell ID="TableCell5" runat="server" VerticalAlign="Top" Width="30%">
                            <img id="ajax_loading_img" 
                                src="Images/AjaxLoading.gif" 
                                alt="" title="Loading" 
                                style="display: none; height: 20px; width: 20px" />
                            </asp:TableCell>
                        </asp:TableRow>
                        <asp:TableRow runat="server">
                            <asp:TableCell runat="server" VerticalAlign="Top" Width="30%">
                                <asp:Label ID="Label1" runat="server" Text="Pass No.:"></asp:Label>
                            </asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top" Width="5%"></asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top" Width="30%">
                                <asp:Label ID="Label2" runat="server" Text="Customer:"></asp:Label>
                            </asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top" Width="5%"></asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top" Width="30%">
                                <asp:Label ID="Label3" runat="server" Text="Authorised By:"></asp:Label>
                            </asp:TableCell>
                        </asp:TableRow>
                        <asp:TableRow runat="server">
                            <asp:TableCell runat="server" VerticalAlign="Top">
                                <asp:DropDownList ID="passNo_DropDownList" runat="server"  Width="100%">
                                </asp:DropDownList>
                            </asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top"></asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top">
                            <asp:HiddenField ID="hdCustID" runat="server" />
                                <asp:TextBox 
                                    ID="customer_TextBox" 
                                    runat="server" 
                                    Width="100%" 
                                    autocomplete="off"></asp:TextBox>
                                    <script type="text/javascript">
                                        function customer_TextBox_OnClientPopulating(sender, e) {
                                            //Before starting ajax request
                                            var loadingdiv = document.getElementById('ajax_loading_img');
                                            loadingdiv.style.display = "block";
                                        }
                                        function customer_TextBox_OnClientCompleted(sender, e) {
                                            //after the ajax request is complete
                                            var loadingdiv = document.getElementById('ajax_loading_img');
                                            loadingdiv.style.display = "none";
                                        }
                                        function customer_TextBox_itemSelected(sender, e) {
                                            var hdCustID = $get('<%= hdCustID.ClientID %>');
                                            hdCustID.value = e.get_value();
                                        }
                                    </script>
                                <asp:AutoCompleteExtender 
                                    ID="customer_TextBox_AutoCompleteExtender" 
                                        CompletionSetCount="20"
                                        MinimumPrefixLength="1"
                                        runat="server" 
                                        DelimiterCharacters="" 
                                        Enabled="True" 
                                        ServicePath="AccessRecords.aspx" 
                                        TargetControlID="customer_TextBox" 
                                        UseContextKey="True" 
                                        ServiceMethod="GetCustomerCompletionList" 
                                        OnClientItemSelected="customer_TextBox_itemSelected"
                                        OnClientHiding="customer_TextBox_OnClientCompleted"
                                        OnClientPopulated="customer_TextBox_OnClientCompleted" 
                                        OnClientPopulating="customer_TextBox_OnClientPopulating">
                                </asp:AutoCompleteExtender>
                            </asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top"></asp:TableCell>
                            <asp:TableCell runat="server" VerticalAlign="Top">
                                <asp:DropDownList ID="authorizedBy_DropDownList" runat="server"  Width="100%">
                                </asp:DropDownList>
                            </asp:TableCell>
                        </asp:TableRow>
                        <asp:TableRow runat="server">
                            <asp:TableCell runat="server" VerticalAlign="Top" ColumnSpan="5">
                                <asp:Label ID="Label4" runat="server" Text="Reason:"></asp:Label>
                            </asp:TableCell>
                        </asp:TableRow>
                        <asp:TableRow runat="server">
                            <asp:TableCell runat="server" VerticalAlign="Top" ColumnSpan="5">
                                <asp:TextBox 
                                    ID="purpose_TextBox" 
                                    runat="server" 
                                    Height="80px" 
                                    TextMode="MultiLine" 
                                    Width="350px"
                                    autocomplete="off"></asp:TextBox>
                                &nbsp;
                                <asp:Button ID="issuePass_Button" runat="server" Text="Issue Pass" height="22px" Width="100px" />
                            </asp:TableCell>
                        </asp:TableRow>
                    </asp:Table>

                </ContentTemplate>
                </asp:UpdatePanel>



            </fieldset>
        </div>
        <br />
        <div class="grouped">
            <fieldset class="groupbox">
            <legend>Access Records</legend>
            <asp:Timer ID="Timer1" runat="server" Interval="30000" Enabled="False">
            </asp:Timer>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="accessRecords_GridView" runat="server" 
                            AlternatingRowStyle-CssClass="GridViewAlternatingRowStyle" 
                            AutoGenerateColumns="False" HeaderStyle-CssClass="GridViewHeaderStyle" 
                            RowStyle-CssClass="GridViewRowStyle" Width="100%">
                            <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                            <Columns>
                                <asp:BoundField DataField="Id" HeaderText="Id" Visible="False" />
                                <asp:BoundField DataField="PassSerialNumber" HeaderText="PassSerialNumber" />
                                <asp:BoundField DataField="CustomerIdNumber" HeaderText="CustomerIdNumber" />
                                <asp:BoundField DataField="CustomerName" HeaderText="CustomerName" />
                                <asp:BoundField DataField="CustomerPhone" HeaderText="CustomerPhone" />
                                <asp:BoundField DataField="IssuedPassNo" HeaderText="IssuedPassNo" />
                                <asp:BoundField DataField="AuthorizedByUser" HeaderText="AuthorizedByUser" />
                                <asp:BoundField DataField="IssuedByUser" HeaderText="IssuedByUser" />
                                <asp:BoundField DataField="IssuedDate" HeaderText="IssuedDate" />
                                <asp:BoundField DataField="Purpose" HeaderText="Purpose" />
                                <asp:ButtonField 
                                    CommandName="Retrieve" 
                                    DataTextField="Id" 
                                    DataTextFormatString="Retrieve" 
                                    Text="Button"/>
                                <asp:ButtonField CommandName="Lost" DataTextField="Id" 
                                    DataTextFormatString="Lost" Text="Button" />
                            </Columns>
                            <HeaderStyle CssClass="GridViewHeaderStyle" />
                            <RowStyle CssClass="GridViewRowStyle" />
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
            </fieldset>
        </div>
        <br />
        <br />
        <br />
        <br />
        <br />
    </div>
</asp:Content>
